<!--
  移动签批->移动签批
-->
<template>
	<view>
		<van-collapse v-model="topShow" accordion @change="changeCollapse">
			<van-collapse-item name="jjzygw">
				<template #title>
					<view :class="topShow == 'jjzygw'?'content':''">
            <span><i class="iconfont icon-jieshou1 content-icon"></i>紧急重要公文</span>
						<van-badge v-if="total0 > 0" :content="total0 || 0" max="99" class="content-badge"></van-badge>
					</view>
				</template>
				<signList01 ref="signList01" :todoTab="todoTab0" :finishStatus="finish0"/>
			</van-collapse-item>
			<van-collapse-item name="xsbw">
        <template #title>
          <view :class="topShow == 'xsbw'?'content':''">
            <span><i class="iconfont icon-shoufawen content-icon"></i>限时办文</span>
            <van-badge v-if="total1 > 0" :content="total1 || 0" max="99" class="content-badge"></van-badge>
          </view>
        </template>
				<signList02 ref="signList02" :todoTab="todoTab1" :finishStatus="finish1"/>
			</van-collapse-item>
			<van-collapse-item name="dsqgw">
        <template #title>
          <view :class="topShow == 'dsqgw'?'content':''">
            <span><i class="iconfont icon-jieshoufenfa_huaban1 content-icon"></i>待审签公文</span>
            <van-badge v-if="total2 > 0" :content="total2 || 0" max="99" class="content-badge"></van-badge>
          </view>
        </template>
				<signList03 ref="signList03" :todoTab="todoTab2" :finishStatus="finish2"/>
			</van-collapse-item>
			<van-collapse-item name="dybgw">
        <template #title>
          <view :class="topShow == 'dybgw'?'content':''">
            <span><i class="iconfont icon-wendang content-icon"></i>待阅办公文</span>
            <van-badge v-if="total3 > 0" :content="total3 || 0" max="99" class="content-badge"></van-badge>
          </view>
        </template>
				<signList04 ref="signList04" :todoTab="todoTab3" :finishStatus="finish3"/>
			</van-collapse-item>
		</van-collapse>
	</view>
</template>

<script>
	import signList01 from 'pages/admin/components/sendDoc/compo-signList.vue'
	import signList02 from 'pages/admin/components/sendDoc/compo-signList.vue'
	import signList03 from 'pages/admin/components/sendDoc/compo-signList.vue'
	import signList04 from 'pages/admin/components/sendDoc/compo-signList.vue'
	export default {
		components: {
			signList01,
			signList02,
			signList03,
			signList04
		},
		onLoad:function(option) {
			this.userInfo = this.cache.get('userInfo')//从缓存获取用户信息
			//从地址栏获取proInstId
			// console.log(proInstId);
			if(option.topShow != undefined && option.topShow != ''){
				this.topShow= option.topShow
				this.changeCollapse(this.topShow)
			}
          this.getCaacMytodoWorks(0)//0紧急重要
          this.getCaacMytodoWorks(1)
          this.getCaacMytodoWorks(2)
          this.getCaacMytodoWorks(3)
		},
		data() {
			return {
				userInfo:{},//当前登录用户信息，目前先从缓存中获取
				todoTab0: '0',//紧急重要
				todoTab1: '1',//限时办文
				todoTab2: '2',//待审签
				todoTab3: '3',//待阅办
				finish0: false,
				finish1: true,
				finish2: true,
				finish3: true,
				total0: 0,
				total1: 0,
				total2: 0,
				total3: 0,
				topShow: 'jjzygw',//默认展开哪个
			};
		},
		mounted() {

		},
		methods: {
			changeCollapse(activeName) {
				if(activeName == 'jjzygw') {
					this.todoTab0 = '0'
					this.finish0 = false
					this.finish1 = true
					this.finish2 = true
					this.finish3 = true
				}
				if(activeName == 'xsbw') {
					this.todoTab1 = '1'
					this.finish1 = false
					this.finish0 = true
					this.finish2 = true
					this.finish3 = true
				}
				if(activeName == 'dsqgw') {
					this.todoTab2 = '2'
					this.finish2 = false
					this.finish0 = true
					this.finish1 = true
					this.finish3 = true
				}
				if(activeName == 'dybgw') {
					this.todoTab3 = '3'
					this.finish3 = false
					this.finish0 = true
					this.finish1 = true
					this.finish2 = true
				}
			},

			//1.获取待办汇总接口todoTab 必传 类型 0紧急重要  1限时办文  2待审签   3待阅办
			//调用示例：http://192.168.240.130:8088/caac/oa/mywork/MytodoWorks?todoTab=0&page=1&rows=10
			getCaacMytodoWorks(todoTab){
				var _this = this
				this.$http({
				  url: this.$http.adornUrl(`/caac/oa/mywork/MytodoWorks`),
				  method: 'get',
				  // timeout:80000,
				  params: this.$http.adornParams({
					  'todoTab': todoTab,
					  'page': '1',
					  'rows': '1',
					  'systemKey': this.userInfo.systemKey,//固定值
					  'systemFlag': this.userInfo.systemFlag,//固定值
				  })
				}).then(({data}) => {
					console.log("-------signList-MytodoWorks-data: " + JSON.stringify(data));
					if(data.code==200){
						if(todoTab == 0){//紧急重要
							_this.total0 = data.data.total
						}else if(todoTab == 1){//限时办文
							_this.total1 = data.data.total
						}else if(todoTab == 2){//待审签
							_this.total2 = data.data.total
						}else if(todoTab == 3){//待阅办
							_this.total3 = data.data.total
						}
					}else{
						_this.$toast("服务器异常：code="+data.code)
					}
				})
			},
		},
	};
</script>

<style>
	/deep/ .van-collapse-item__content {
		padding: 0px;
		color: #969799;
		font-size: 14px;
		line-height: 1.5;
		background-color: #fff
	}

  .content {
    font-weight: 600;
    color: #007aff;
  }
  .content-icon {
    margin-right: 10rpx;
  }
  .content-badge {
    margin-left: 10rpx;
  }
</style>
